#_*_coding:utf-8_*_
__author__ = 'lll'
import socket
import json
import time

ip_port = ('140.206.122.22', 21000)
BUFSIZE = 1024
udp_server_client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

msg = json.dumps({
    "ip": "140.206.122.22",
    "port": "21000",
    "oemCode": "4B8BC4EC",
    "vehicleId": 'aabbccdd11111111',
    "token": "48585154",
    "aesKey": "M20YDV7VSPQSYPKS",
    "heading": "300",
    "longitude": "1212134817",
    "latitude": "312916495"
})

vehicleId_list = [[] for id in range(11, 131)]
start_time = time.time()
while True:
    if not msg:continue

    udp_server_client.sendto(msg.encode('utf-8'),ip_port)
    vehicleId_list[0].append(1)
    time.sleep(0.86)
    # back_msg,addr=udp_server_client.recvfrom(BUFSIZE)
    # print(back_msg.decode('utf-8'),addr)
    if time.time() - start_time > 5:
        break

print(len(vehicleId_list[0]))